#include "STC89C5xRC.h"

#define u16 unsigned int
#define u8  unsigned char
#define beep P23 
#define WELA P27
#define DULA P26

u8 code table[] = {
									0x3f,0x06,0x5b,0x4f,
									0x66,0x6d,0x7d,0x07,
									0x7f,0x6f,0x77,0x7c,
									0x39,0x5e,0x79,0x71,0x00};
void DelayMs(u16 ms);


void main()                                                                                            
{

	while(1)
	{
		WELA = 1;
		P0 = 0Xfe;
		WELA = 0;  
		DULA = 1;
		P0 = table[1];
		DULA = 0;
		DelayMs(1);
		
		WELA = 1;
		P0 = 0Xfd;
		WELA = 0;  
		DULA = 1;
		P0 = table[2];
		DULA = 0;
		DelayMs(1);
		
		WELA = 1;
		P0 = 0Xfb;
		WELA = 0;  
		DULA = 1;
		P0 = table[3];
		DULA = 0;
		DelayMs(1);
	}
}

void DelayMs(u16 ms)
{
	u16 a,b;
	for(a = ms;a > 0;a--)
		for(b = 114;b > 0;b--);
}


